<ion-view view-title="购买">
    <ion-nav-buttons side="left">
        <back-button></back-button>
    </ion-nav-buttons>
    <ion-content ng-class="{'has-loading': isOffline}">
        <!-- panel -->
        <div ng-show="!param.isSuccess">
            <div class="panel tp" >
                <div class="item fs1" ng-switch="cmsProdInfo.prod_profit_mode">
                    <span class="title">购买品种</span>
                    <span class="txt_m word-wrap" ng-switch-when="0">{{cmsProdInfo.prod_name}} <i>（七日年化{{cmsProdInfo.prod_yield | defNumber : 4 : '%'}}）</i></span>
                    <span class="txt_m word-wrap" ng-switch-when="1" ng-if="cmsProdInfo.price_increase_year.length > 0">{{cmsProdInfo.prod_name}} <i>（近一年回报率{{cmsProdInfo.price_increase_year | defNumber : 2 : '%'}}）</i></span>
                    <span class="txt_m word-wrap" ng-switch-when="1" ng-if="!cmsProdInfo.price_increase_year || cmsProdInfo.price_increase_year.length == 0">{{cmsProdInfo.prod_name}} <i>（近半年回报率{{cmsProdInfo.price_increase_month6 | defNumber : 2 : '%'}}）</i></span>
                    <span class="txt_m word-wrap" ng-switch-when="2" ng-if="cmsProdInfo.prod_catalog_mark=='otcfdsy'">{{cmsProdInfo.prod_name}} <i>（预期年化{{cmsProdInfo.prod_profit_rate_min | defNumber :0}}%~{{cmsProdInfo.prod_profit_rate_max | defNumber :0}}%）</i></span>
                    <span class="txt_m word-wrap" ng-switch-when="2" ng-if="cmsProdInfo.prod_catalog_mark!='otcfdsy'">{{cmsProdInfo.prod_name}} <i>（预期年化{{cmsProdInfo.prod_profit_rate | defNumber : 4 : '%'}}）</i></span>
                    <span class="txt_m word-wrap" ng-switch-when="3" ng-if="cmsProdInfo.prod_catalog_mark == 'fdxqszg'">{{cmsProdInfo.prod_name}} <i>（近一年回报率{{cmsProdInfo.price_increase_year | defNumber : 2 : '%'}}）</i></span>
                    <span class="txt_m word-wrap" ng-switch-when="3" ng-if="cmsProdInfo.prod_catalog_mark != 'fdxqszg'">{{cmsProdInfo.prod_name}} <i>（预期年化{{cmsProdInfo.expYearYield | defNumber : 4 : '%'}}）</i></span>
                    <span class="txt_m word-wrap" ng-switch-default>——</i></span>
                </div>
            </div>
            <!-- panel -->
            <div class="panel">
                <div class="item fs1">
                    <span class="title">购买金额</span>
                    <input type="number" class="txt_m" value="" placeholder="{{buy.entrust_balance_placeholder}}"
                           ng-model="buy.entrust_balance" ng-blur="entrustBalanceBlur()" />
                </div>
            </div>
            <!-- panel -->
            <div class="little-tip" ng-show="user.corp_risk_level < cmsProdInfo.prod_risk_level">您要购买的基金风险等级高于您的风险承受等级，请确认继续购买</div>

            <div class="agree item" ng-show="user.corp_risk_level < cmsProdInfo.prod_risk_level">
                <ion-checkbox checked="checked" ng-model="buy.checkRisk"></ion-checkbox>
                <a>同意购买的基金风险等级高于风险承受等级</a>
            </div>

            <div class="little-tip" ng-show="!param.ta_open">您还未开通该机构的TA账户，请确认继续购买，系统将自动为您开通！</div>

            <div class="agree item" ng-show="!param.ta_open">
                <ion-checkbox checked="checked" ng-model="buy.checkOpen"></ion-checkbox>
                <a>同意开通该机构TA账户</a>
            </div>

            <div class="kCells tran" ng-show="agreementList">
                <div class="kCell">
                    <input type="checkbox" class="kChk" ng-model="buy.checkProtocol">
                    <div class="kCellPrimary">我已阅读并同意<a ng-href="#/trade/agreementList?prod_id={{cmsProdInfo.prod_id}}" class="clr2">《{{cmsProdInfo.prod_name}}购买协议》</a></div>
                </div>
            </div>

            <!-- button -->
            <div class="btnbox">
                <a class="btn" ng-click="next()">确 定</a>
            </div>
        </div>
        <!-- proc -->
        <div ng-show="param.isSuccess">
            <div class="proc">
                <ol ng-if="success.type == 1">
                    <li></li>
                    <li class="lit none"><i class="icon_orderComplete"></i>
                        <h2>已提交购买订单 {{cmsProdInfo.prod_name}}</h2>
                        <p>购买金额 {{buy.entrust_balance}}</p></li>
                    <li><i class="icon_calculationIncome"></i>
                        <h2>开始计算收益</h2>
                        <p>{{success.income_begin_time}}</p></li>
                    <li><i class="icon_dispIncome"></i>
                        <h2>确认购买份额 显示收益</h2>
                        <p>{{success.income_show_time}}</p></li>
                </ol>
                <ol ng-if="success.type == 2">
                    <li></li>
                    <li class="lit none"><i class="icon_orderComplete"></i>
                        <h2>已提交购买订单 {{cmsProdInfo.prod_name}}</h2>
                        <p>购买金额 {{buy.entrust_balance}}</p></li>
                    <li><i class="icon_calculationIncome"></i>
                        <h2>确认购买份额 开始计算收益</h2>
                        <p ng-bind-html="success.begin_time"></p>
                    </li>
                </ol>
            </div>
            <!-- tips -->
            <div class="little-tip">温馨提醒：请在我的账簿-我的交易中留意查看该笔成交单的确认情况</div>
            <div class="little-tip" ng-if="cmsProdInfo.prod_catalog_mark=='otcfdsy'">页面展示的预期收益率仅作购买参考，实际收益率以产品到期当日计算的收益率为准。</div>
            <!-- panel -->
            <div class="panel">
                <div class="item group"><a href="#/tab/account-orders"><i class="icon_tradeLog"></i>查看我的交易记录</a></div>
                <div class="item group"><a href="{{param.continueBuyUrl}}"><i class="icon_cart"></i>继续购买</a></div>
            </div>
        </div>
        <div class="credible">
            <p>天风证券官方理财平台</p>
            <p>中国证监会核准基金销售机构，资金受“中国证监会证券市场交易结算资金监控系统”监管</p>
        </div>
    </ion-content>
</ion-view>